<!--  -->
<template>
  <view class="body_one">
    <view class="jiner">
      ¥{{ price }}
    </view>
    <view class="name">
      <view class="name_one">商品名称</view>
      <view class="activityName">{{ activityName }}</view>
    </view>
    <view class="view_serry">
      <view class="pay_one">支付方式</view>
      <view class="one_img">
        <view class="img_one">
          <image src="../../static/weixin.png" @click="wx_click"></image>
          <view class="pay_two">微信支付</view>
        </view>
        <view class="img_one">
          <image src="../../static/zhifubao.png" @click="Alipay_click"></image>
          <view class="pay_two">支付宝支付</view>
        </view>
      </view>
    </view>
    <view class="view_one">
      <view class="btn_view" @click="liji_pay">
        立即付款
      </view>
    </view>
  </view>
</template>

<script>
  //这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
  //例如：import 《组件名称》 from '《组件路径》';
  import {
    unifiedWxPayOrder,
    payNow
  } from '@/common/request/api.js'
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    data() {
      //这里存放数据
      return {
        activityId: "",
        idCard: "",
        museumId: '',
        name: "",
        phone: "",
        price: "",
        activityName: ''
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {},
    //方法集合
    methods: {
      liji_pay() {
        uni.showToast({
          title: '请选择支付方式',
          icon: 'none',
          mask: true
        })
      },

      //微信支付
      wx_click() {
        this.unifiedWxPayOrder1()
      },
      //支付宝支付
      Alipay_click() {
        this.payNow1()
      },
      //支付宝支付
      payNow1() {
        payNow({
          activityId: this.activityId,
          idCard: this.idCard,
          museumId: this.museumId,
          name: this.name,
          phone: this.phone,
          certType: "身份证",
          activityName: this.activityName
        }).then((res) => {
          console.log(res);
        })
      },
      //微信支付
      unifiedWxPayOrder1() {
        unifiedWxPayOrder({
          activityId: this.activityId,
          idCard: this.idCard,
          museumId: this.museumId,
          name: this.name,
          phone: this.phone,
          certType: "身份证",
          activityName: this.activityName
        }).then((res) => {
          console.log(res);
        })
      }
    },
    onLoad(options) {
      console.log(options);
      this.activityId = options.activityId
      this.idCard = options.idCard
      this.museumId = options.museumId
      this.name = options.name
      this.phone = options.phone
      this.price = options.price
      this.activityName = options.activityName
    },
    beforeCreate() {}, //生命周期 - 创建之前
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {

    },
    beforeMount() {}, //生命周期 - 挂载之前
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {

    },
    beforeUpdate() {}, //生命周期 - 更新之前
    updated() {}, //生命周期 - 更新之后
    beforeDestroy() {}, //生命周期 - 销毁之前
    destroyed() {}, //生命周期 - 销毁完成
    activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
  }
</script>
<style lang="less" scoped src="./index.less">

</style>